Subject: Re: Optimizing E
From: [email-masked] (Son Huu Le)
To: [email-masked]
Date: Tue, 13 Jul 1993 11:39:03 +1000 (EST)

> 
> Hi, Son Le.  Long time, eh?

 (; Working on anything lately, Barry?
 
> >what are the proper arguments for the DOS function SetVBuf()? The DOS
> >manual says it accepts 4 arguments, E only accepts 3!?
> 
> I remember you asking this before.  Don't know, so I didn't answer.

I was hoping Wouter could answer this for me. He properly missed the last one.
 
> >I was debugging my programs, I noticed that E always(?) used MOVE.L x(A5),D0
> >for variable storage/retrieval. In a tight loop, a MOVE.L x(AN),D0
> >will cost more cycle time than a MOVE.L D1,D0. Since E doesn't touch the
> >other data registers often, it would help speed time greatly if you could
> >use them.
> 
> Hmmmm.  What debugger do you use?

Monam with Devpac. It's great, once you get use to it. (;
 
> I'm interested in the results of replacing:
>   in E...  x++  <->  INC x
>   in C...  x++  <->  x += 1

Well, in the first case, E produced the exact code, minus that bogus instr. I
queried.. hmmm.. weird. In the second case.. the same. Did Wouter say that
the new version can output debug symbols?
 
> I recall Wouter saying that ++ returns a value and eats up some ticks in the
> process.  That may be what's going on in that Asm instruction you questioned,
> the value is being returned in D0.  The C compiler sees that you're not doing
> anything with the returned value, so optimizes it away.

Sound logical. But E could be much faster if it detected a loop or a low number
of variables, and transfer them all to data registers. Or perhaps a keyword 
that you can use to tell E you want the variable in a register and if there's
a free register, E uses it. A bit more work, but if you're going to produce
efficient and compact codes, it's essential.

> >One last suggestion.. how about making some E functions (such as WriteF)
> >more assembling friendly, so you can use certain E functions in the middle
> >of an assembly code? ie. it uses only the upper data/address registers (4-7)
> >and leaves the lower ones intact.
> 
> Wouter told me you can do this:
>     MOVEM D0-D7/A0-A3,(A7)+  ;/* Save multiple regs, post inc stack (SP). */
>     WriteF ('whatever')
>     MOVEM -(A7),D0-D7/A0-A3  ;/* Pre dec stack, restore multiple regs (SP). */
> 
> I'm not at home right now, so I'm not sure about the syntax.  A7 here is the
> program stack pointer (SP).  If you want to correct the syntax and post it to
> the list, I'd appreciate it.

Good idea, forgot about it. Still, a bit cumbersome, but it's do.
Btw: The syntax looks pretty much like the correct syntax. (;

Cheers..
Son Le